<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

/* tooltip */
#tooltip{
  position:absolute;
  border:1px solid #ccc;
  background:#333;
  padding:2px;
  display:none;
  color:#fff;
}
</style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
      <form class="layui-form serch" action="{:url('admin/Groups/index')}" method="post">
        <div class="layui-form-item" style="float: left;">
          <div class="layui-input-inline">
            <input type="text" name="remarkname" lay-verify="title" autocomplete="off" placeholder="请输入用户名" class="layui-input layui-btn-sm">
          </div>
          <div class="layui-input-inline">
            <input type="text" name="group" lay-verify="title" autocomplete="off" placeholder="请输入群名" class="layui-input layui-btn-sm">
          </div>
          <div class="layui-input-inline">
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="create_time" placeholder="创建时间" name="day">
              </div>
            </div>
          </div>
          <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
        </div>
      </form> 
    <table class="layui-table" lay-size="sm">
      <thead>
        <tr>
          <th>ID</th>
          <th>用户</th>
          <th>自己微信</th>
          <th>群名</th>
          <th>金额</th>
          <th>创建时间</th>
          <th>操作</th>
        </tr> 
      </thead>
      <tbody>
        {volist name="group" id="vo"}
        <tr>
          <td>{$vo.id}</td>
          <td>{$vo.users.remarkname}</td>
          <td>{$vo.myself}</td>
          <td>{$vo.group}</td>
          <td>{$vo.money}</td>
          <td>{$vo.time|date="Y-m-d H:i:s",###}</td>
          <td class="operation-menu">
            <div class="layui-btn-group">
              <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary agree" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon">&#xe605;</i></a>
              <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary reject" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon">&#x1006;</i></a>
              <a href="{:url('admin/groups/edit',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu layui-btn-primary" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
              <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
            </div>
          </td>
        </tr>
        {/volist}
      </tbody>
    </table>
    <div style="padding:0 20px;">{$group->render()}</div>
    {include file="public/foot"}
    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/groups/delete')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    });

    $('.agree').click(function(){
        var id = $(this).attr('data-id');
        layer.confirm('确定通过审核?', function(index) {
            $.ajax({
                url:"{:url('admin/groups/agree')}",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    });

    $('.reject').click(function(){
        var id = $(this).attr('data-id');
        layer.confirm('确定拒绝?', function(index) {
            $.ajax({
                url:"{:url('admin/groups/reject')}",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    })
    </script>
  </div>
</body>
</html>
